import { GET, route, POST } from 'awilix-koa'; // 容器
import { IRequest } from 'src/interface/IRequest';

@route('/')
class indexController {
  request: IRequest;

  constructor({ request }) {
    this.request = request;
  }

  /**
   * @api {get} /user/id Request User information
   * @apiName GetUser
   * @apiGroup User
   *
   * @apiParam {Number} id Users unique ID.
   *
   * @apiSuccess {String} firstname Firstname of the User.
   * @apiSuccess {String} lastname  Lastname of the User.
   */
  @route('table')
  @GET()
  async actionTableList(ctx, next) {
    const result = await this.request.get('/nCoV/api/area');
    ctx.body = result;
  }

  @route('map')
  @POST()
  async actionMapBikeList(ctx, next) {
    const result = await this.request.post('/testPost', ctx.request.body);
    ctx.body = result;
  }
}

export default indexController;
